<?php
session_start();
require_once 'config.php';
require_once 'dbc.php';
require_once 'functions.php';
require_once 'pagePieces.php';

if(!logged_in()){
	header("Location: index.php");
	exit();
}

if(isset($_GET["vote"])){
	$url = $_GET["vote"];
	if(canVoteForSite($url, $votingSites)){
		if(voteForSite($url, $votingSites)){
			header("Location: $url");
			exit();
		}
	}
	header("Location: index.php");
	exit();
}
?>